package zhaomh.catgirlcharm;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;


public class CatGirlCharmClient implements ClientModInitializer {
    private static KeyBinding keyBinding;

    @Override
    public void onInitializeClient() {

        keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "catgirlcharm.key.configgui",
                InputUtil.Type.KEYSYM,
                GLFW.GLFW_KEY_O,
                "catgirlcharm.key"
        ));
        ClientTickEvents.END_CLIENT_TICK.register(mc->{
            while (keyBinding.wasPressed()) {
                mc.setScreen(CatGirlCharm.functionMod.getGui());

            }
        });

        ClientLifecycleEvents.CLIENT_STOPPING.register(mc->{
            CatGirlCharm.functionMod.exit();
        });
    }
}
